VERSION 5.00
Begin VB.Form SavingVCTDataForm 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   BorderStyle     =   0  'None
   ClientHeight    =   9000
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   12000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   9000
   ScaleWidth      =   12000
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   WindowState     =   2  'Maximized
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   3000
      Left            =   10140
      Top             =   1740
   End
   Begin VCT.PatientTestResultForm PatientTestResultForm 
      Height          =   1575
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Visible         =   0   'False
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   2778
   End
   Begin VB.Label Title 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Saving VCT data to the database and printing test results for client"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   24
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Left            =   2400
      TabIndex        =   1
      Top             =   3240
      Width           =   7335
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "please wait ..."
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   24
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   6120
      TabIndex        =   0
      Top             =   4740
      Width           =   3795
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H00C0E0FF&
      BorderWidth     =   3
      FillColor       =   &H00C0FFFF&
      FillStyle       =   0  'Solid
      Height          =   3555
      Left            =   1260
      Shape           =   4  'Rounded Rectangle
      Top             =   2520
      Width           =   9615
   End
End
Attribute VB_Name = "SavingVCTDataForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
   Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
   PrintPatientTestResultSheet
   VCTStageForm.Show
   Unload Me
End Sub

Private Sub PrintPatientTestResultSheet()
   
   Dim BarCodeString As String
   Dim BarCodeHexString As String
   
   'Get the HIV Test Results
   CnUser.Open ConnectString
   Cmd.CommandText = "SELECT TEST1NAME, TEST2NAME, TEST3NAME, TEST1RESULT, TEST2RESULT, TEST3RESULT, VDATE, ADDRESS" _
                  & " FROM   client" _
                  & " WHERE  VISITID = " & VISITID
   Cmd.CommandType = adCmdText
   Cmd.ActiveConnection = CnUser
   RsUser.Open Cmd, , adOpenStatic
   TEST1NAME = RsUser(0)
   TEST2NAME = RsUser(1)
   TEST3NAME = RsUser(2)
   Test1Result = RsUser(3)
   Test2Result = RsUser(4)
   Test3Result = RsUser(5)
  ' LabTech = RsUser(6)
   VDATE = RsUser(6)
   ClientAddress = RsUser(7)
   RsUser.Close
   CnUser.Close
   
   BarCodeString = CLIENTCO
   While Len(BarCodeString) < 7 ' pad it to 7 digits
      BarCodeString = "0" & BarCodeString
   Wend
   BarCodeString = "00" & BarCodeString '00 is for the outreach code
   BarCodeString = SITE & BarCodeString
   BarCodeHexString = HexVal(BarCodeString)
   PatientTestResultForm.BarCode = BarCodeHexString

   PatientTestResultForm.CentreCode = SITE
   PatientTestResultForm.ClientCode = CLIENTCO
   If Sex = 1 Then
      PatientTestResultForm.Sex = "M"
   Else
      If Sex = 2 Then
         PatientTestResultForm.Sex = "F"
      Else
         PatientTestResultForm.Sex = "E"
      End If
   End If
   PatientTestResultForm.Age = Age
   PatientTestResultForm.PartnerCode = PARTCODE
   PatientTestResultForm.CoupleCode = COUPCODE
   PatientTestResultForm.CurrentRes = ClientAddress
   PatientTestResultForm.CounselorCode = COUNCODE
   PatientTestResultForm.Test1Type = TEST1NAME
   If Test1Result = "0" Then
      PatientTestResultForm.Test1Result = "NON-REACTIVE"
   Else
      If Test1Result = "1" Then
         PatientTestResultForm.Test1Result = "REACTIVE"
      Else
         If Test1Result = "" Then
            PatientTestResultForm.Test1Result = "N/A"
         Else
            PatientTestResultForm.Test1Result = "ERROR"
         End If
      End If
   End If
   
   PatientTestResultForm.Test2Type = TEST2NAME
   If Test2Result = "0" Then
      PatientTestResultForm.Test2Result = "NON-REACTIVE"
   Else
      If Test2Result = "1" Then
         PatientTestResultForm.Test2Result = "REACTIVE"
      Else
         If Test2Result = "" Then
            PatientTestResultForm.Test2Result = "N/A"
         Else
            PatientTestResultForm.Test2Result = "ERROR"
         End If
      End If
   End If
   PatientTestResultForm.Test3Type = TEST3NAME
   If Test3Result = "0" Then
      PatientTestResultForm.Test3Result = "NON-REACTIVE"
   Else
      If Test3Result = "1" Then
         PatientTestResultForm.Test3Result = "REACTIVE"
      Else
         If Test3Result = "" Then
            PatientTestResultForm.Test3Result = "N/A"
         Else
            PatientTestResultForm.Test3Result = "ERROR"
         End If
      End If
   End If
   PatientTestResultForm.TestDate = VDATE
  ' PatientTestResultForm.LabTech = LabTech
   PatientTestResultForm.PrintForm
End Sub

